<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h3>内置对象</h3>
<h1>内置对象：strings对象</h1>
<div>
    <span th:text="${name}">名称</span><br/>
    判断字字符串是否为空：<span th:text="${#strings.isEmpty(name)}"/><br/>
    判断字符串是否以xx开头：<span th:text="${#strings.startsWith(name,'kkm')}"/><br/>
    判断字符串是否以xx结尾：<span th:text="${#strings.endsWith(name,'89')}"/><br/>
    判断字符串是否以包含xx：<span th:text="${#strings.contains(name,'bm')}"/><br/>
    返回字符串长度：<span th:text="${#strings.length(name)}"/><br/>
    查找子串的位置，没找到就返回-1：<span th:text="${#strings.indexOf(name,'m')}"/>
</div>
<h2>内置对象：dates对象</h2>
<h3 style="color: green">语法：#dates.format(key,'yyyy/mm/dd')</h3>
<h4 style="color: red">注意：key值的类型要是date，否则会报错null</h4>
<div>
    原始数据：<span th:text="${hireDate}"/><br/>
    浏览器格式化：<span th:text="${#dates.format(hireDate)}"></span><br/>
    自定义格式化：<span th:text="${#dates.format(hireDate,'yyyy/MM/dd HH:mm:ss')}"></span><br/>
    年：<span th:text="${#dates.year(hireDate)}"/><br/>
    月：<span th:text="${#dates.month(hireDate)}"/><br/>
    日：<span th:text="${#dates.day(hireDate)}"/><br/>
</div>
<h2>内置对象：numbers对象</h2>
<h3 style="color: green">语法：#numbers.formatDecimal(num,3,'COMMA',1,'POINT')</h3>
<h3 style="color: green">说明：num是key；3表示整数位；COMMA：','；POINT：‘.’</h3>
<h3 style="color: red">注意：key值的类型可以是String或double，不区分</h3>
<div>
    原始数据：<span th:text="${num}"></span><br/>
    表示整数位至少三位位，不足以0补齐：<span th:text="${#numbers.formatDecimal(num,3,'COMMA',1,'POINT')}"></span>
</div>
<h2>内置对象：域对象</h2>
<h3 style="color: green">包含：HttpServletRequest、HttpSession、ServletContext</h3>
<div>
    <h4>HttpServletRequest</h4>
    <span th:text="${#httpServletRequest.getAttribute('msg')}"></span><br/>
    <span th:text="${#request.getAttribute('msg')}"></span><br/>
    <h4>HttpSession</h4>
    <span th:text="${#httpSession.getAttribute('msg')}"></span><br/>
    <span th:text="${#session.getAttribute('msg')}"></span><br/>
    <h4>ServletContext</h4>
    <span th:text="${#servletContext.getAttribute('msg')}"></span><br/>
    <span th:text="${application.msg}"></span><br/>
</div>

</body>
</html>